package com.basemodel;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
@ApiModel(description = "分页返回结果")
public class PageResult<T> {

    @ApiModelProperty("页码")
    private int page;

    @ApiModelProperty("每页大小")
    private int size;

    @ApiModelProperty("总数据量")
    private long total;

    @ApiModelProperty("数据")
    private List<T> data;

    public PageResult() {
    }

    public PageResult(int page, int size, long total, List<T> data) {
        this.page = page;
        this.size = size;
        this.total = total;
        this.data = data;
    }

    private static PageResult _emptyPage = new PageResult();

    public static PageResult emptyPage() {
        return _emptyPage;
    }

}
